package com.louis.springi18n;


import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Date;
import java.util.Locale;


/**
 * @author XRY
 * @date 2023年06月29日10:27
 */
public class ResourceI18n {
    @Test
    public void testCN() {
        ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
        Object[] obj = new Object[]{"khan", new Date().toString()};
        String value = context.getMessage("test", obj, Locale.CHINA);
        System.out.println("value = " + value);
        /*value = welcome khan, 时间：Thu Jun 29 11:03:08 CST 2023*/
    }
    @Test
    public void testUS() {
        ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
        Object[] obj = new Object[]{"louie", new Date().toString()};
        String value = context.getMessage("test", obj, Locale.US);
        System.out.println("value = " + value);
        /*value = welcome louie, 时间：Thu Jun 29 11:06:10 CST 2023*/
    }

}
